﻿Imports KOR.Helpers

Namespace BL

    Public Module LabelColors
#Region "LabelColors_DML"

        Public Function InsertLabelColor(dict As Dictionary(Of String, Object)) As Integer
            Return DDA.Insert("LabelColors", dict)
        End Function

        Public Function UpdateLabelColor(dict As Dictionary(Of String, Object), LabelColorID As Integer) As Integer
            Return DDA.Update("LabelColors", dict, "LabelColorID=" & LabelColorID)
        End Function

        Public Function DeleteLabelColor(ByVal LabelColorID As Integer) As Integer
            Return DDA.Delete("LabelColors", "LabelColorID=" & LabelColorID, False)
        End Function

#End Region

#Region "LabelColors_Selection"

        Public Function GetAllLabelColors() As IDataReader
            Dim sql As String = "SELECT * FROM LabelColors Order By LabelColorID DESC"
            Return DDA.SelectData(sql)
        End Function

        Public Function GetLabelColors(searchFor As String, criteria As String, startRowIndex As Integer, maximumRows As Integer, SortBy As String) As IDataReader
            Dim sql As String
            sql = "SELECT * FROM LabelColors "

            If SortBy = "" Then SortBy = " CreatedDate Desc"

            Return DDA.SelectDataPaginated(sql, startRowIndex, maximumRows, SortBy)
        End Function

        Public Function LabelColorsCount(searchFor As String, criteria As String) As Integer
            Dim sql As String
            sql = "SELECT * FROM LabelColors "
            Return DDA.SelectDataCount(sql)
        End Function

#End Region
    End Module

End Namespace
